CC=gcc
CXX=g++
CFLAGS=-Wall -fPIC -g
LDFLAGS=-Wall -shared -Wl,-soname,libtd_bdd.so
EXT=.so

all:
	rm -rf *.so *.dylib *.dll
	+$(MAKE) add.o del.o get.o read_write.o update.o routines.o make_td.o  
	+$(MAKE) td_div.o td_select.o td_add.o td_del.o td_update.o 
	+$(MAKE) td_error.o td_open_close.o crc32.o
	$(CC) $(LDFLAGS) -o libtd_bdd$(EXT) add.o get.o read_write.o update.o routines.o del.o td_select.o td_div.o td_open_close.o td_add.o td_del.o td_update.o td_error.o make_td.o crc32.o


add.o: bdd.h add.c
	$(CC) -c add.c $(CFLAGS)

del.o: bdd.h del.c
	$(CC) -c del.c $(CFLAGS)

get.o: bdd.h get.c
	$(CC) -c get.c $(CFLAGS)

update.o: bdd.h update.c
	$(CC) -c update.c $(CFLAGS)

td_select.o: bdd.h td_select.c
	$(CC) -c td_select.c $(CFLAGS)

make_td.o: bdd.h make_td.c
	$(CC) -c make_td.c $(CFLAGS)

read_write.o: bdd.h read_write.c
	$(CC) -c read_write.c $(CFLAGS)
	
routines.o: bdd.h routines.c
	$(CC) -c routines.c $(CFLAGS)
	
td_div.o: bdd.h td_div.c
	$(CC) -c td_div.c $(CFLAGS)
	
td_add.o: bdd.h td_add.c
	$(CC) -c td_add.c $(CFLAGS)

td_del.o: bdd.h td_del.c
	$(CC) -c td_del.c $(CFLAGS)

td_update.o: bdd.h td_update.c
	$(CC) -c td_update.c $(CFLAGS)
	
td_error.o: bdd.h td_error.c
	$(CC) -c td_error.c $(CFLAGS)

td_open_close.o: bdd.h td_open_close.c
	$(CC) -c td_open_close.c $(CFLAGS)

crc32.o: crc32.h crc32.c
	$(CC) -c crc32.c $(CFLAGS)

clean:
	rm -rf *.o
	rm -rf *~
